package domain;

import java.util.ArrayList;

public class Tablero {

	private ArrayList<ArrayList<ObjetoEnTablero>> elems;
	
	public Tablero (int size){
		elems = new ArrayList<ArrayList<ObjetoEnTablero>> (size);
		for (int i = 0; i<size; i++){
			elems.add(i, new ArrayList<ObjetoEnTablero> (size) );
		}
			
	}
	
	synchronized  public ObjetoEnTablero getElem(int x, int y){
		return elems.get(x).get(y);
	}
	synchronized public void setElem (ObjetoEnTablero elem, int x, int y){
		elems.get(x).add(y, elem);
	}
	synchronized public void moverElem (int x1, int y1, int x2, int y2){
		ObjetoEnTablero tmp = getElem(x1, y1);
		setElem (tmp, x2, y2);
	}
}
